﻿#include "databasecenter.h"
#include "widget.h"

#include <QApplication>
#include <QFile>

int main(int argc, char *argv[])
{
    //注册类型
    qRegisterMetaType<int8_t>("int8_t");
    qRegisterMetaType<uint8_t>("uint8_t");
    qRegisterMetaType<int16_t>("int16_t");
    qRegisterMetaType<uint16_t>("uint16_t");
    qRegisterMetaType<int32_t>("int32_t");
    qRegisterMetaType<uint32_t>("uint32_t");
    qRegisterMetaType<int64_t>("int64_t");
    qRegisterMetaType<uint64_t>("uint64_t");


    QApplication a(argc, argv);

    QFile qssFile(":/mac_dark.qss");
    if(qssFile.open(QFile::ReadOnly)){
        qApp->setStyleSheet(qssFile.readAll());
        qssFile.close();
    }

    //本程序数据库初始化
    QSqlDatabase useDb = DatabaseCenter::getInstance()->getConnection();
    QSqlQuery useQuery(useDb);

    //策略表
    ScanRule scanrule;
    useQuery.exec(scanrule.generateCreateTableSql(useDb.driverName()));

    DatabaseCenter::getInstance()->releaseConnection(useDb);

    Widget w;
    w.show();
    return a.exec();
}
